import java.sql.Connection;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class Tes{
    public static int cal(int i) {
        int result = 0;
        switch (i) {
            case 1:
                result = result + i;
            case 2:
                result = result + i * 2;
            case 3:
                result = result + i * 3;
        }
        return result;
    }

    public static void t2(){
        String s1 = "aaa";
        String s2 = "bbb";
        //字符串拼接底层原理
        String s3 = new StringBuilder(s1).append(s2).toString();
        System.out.println(s3);
    }

    public static void t3(){
        //Collections.synchronizedList 讲普通类包装成线程安全的
        List<String> l = Collections.synchronizedList(new ArrayList<>());
        l.add("aaa");
        l.add("bbb");
        l.add("ccc");
        l.forEach(System.out::println);

        //ConcurrentHashMap相对HashTable性能更好，且有线程安全
        Map map = new ConcurrentHashMap();
        map.put(1,'a');
        map.put(2,'b');
        map.put(3,'c');
    }

    public static void t4(){
        int a = 10;
        long b = 10;
        System.out.println(a==b);
    }

    void t5()throws Exception{
        Scanner sc = new Scanner(System.in);
        String next = sc.next();
        DateFormat date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String a = "2019-10-31 22:53:10";
        Date date1 = date.parse(a);
        System.out.println(date1);
    }

    static void t6(){
        String s1 = "ee";
        String s2 = "e" + new String("e");
        System.out.println(s1 == s2);
    }

    public static void main(String[] args)  {
        t6();
    }
}
